
/** 
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */
package com.tompai.common.time;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.Locale;

/**
* @desc: datagather-tools
* @name: TimeTest.java
* @author: tompai
* @createTime: 2018年5月8日 下午4:06:30
* @history:
* @version: v1.0
*/

public class TimeTest {

	/**
	* @author: tompai
	* @createTime: 2018年5月8日 下午4:06:30
	* @history:
	* @param args void
	*/

	public static void main(String[] args) {
		//TODO Auto-generated method stub
  
		//String formatType="yyyy-MM-dd E a hh:mm:ss  zzz";
		
		//String formatType="yyyy-MM-ddahh:mm:ss";
		//String formatType="yyyy年MM月dd日ahh:mm";
		//String formatType="dd MMM yyyyh:mm a";//21 Mar 201412:47 PM
		String formatType="h:mm a - dd MMM yyyy";
		String temp="12:08 PM - 19 Apr 2016";
		
		

	   // System.out.println("ld1: " + ld1);
	    
		//System.out.println(ld1);
		Date date = new Date();
		SimpleDateFormat sdf = new SimpleDateFormat(formatType,Locale.ENGLISH);// 年-月-日 星期几 上、下午 时：分：秒 时区
		
		System.out.println(sdf.format(date));
		//DateTimeFormatter formatter = DateTimeFormatter.ofPattern(formatType);
	   // LocalDate ld2 = LocalDate.parse(temp, formatter);
		//System.out.println("ld2: " + ld2);
		try {
			Date date2=TimeTransUtils.stringToDate(temp, formatType);
			System.out.println(date2);
		} catch (ParseException e) {
			
			//TODO Auto-generated catch block
			e.printStackTrace();
			
		}
	}

}

